import React, { PureComponent } from 'react'
import { increAction, getDataListAction } from '../store/actionCreators'
import { connect } from 'react-redux'
class Home extends PureComponent {
  componentDidMount() {
    this.props.getDataList()
  }
  render() {
    return (
      <>
        <h1>home4中当前计数{this.props.counter}</h1>
        <button onClick={() => this.props.incrementClick()}>Home3 + 1</button>
      </>
    )
  }
}
const mapStateToProps = state => ({ counter: state.counter })
const mapDispachToprops = dispatch => {
  return {
    incrementClick: function () {
      dispatch(increAction())
    },
    getDataList: function () {
      dispatch(getDataListAction)
    },
  }
}
export default connect(mapStateToProps, mapDispachToprops)(Home)
